package com.kws.tool.controller;

import com.kws.common.core.domain.R;
import com.kws.tool.dto.VirtualDto;
import com.kws.tool.service.VirtualNumberService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author : zhangbenting
 * @date : 2024/10/25 14:46
 * @Version: 1.0
 */
@RequestMapping("/virtualPhoneManage")
@RestController
@Api(value = "虚拟号码管理", tags = "虚拟号码管理")
public class VirtualPhoneController {
    @Autowired
    private VirtualNumberService virtualNumberService;

    /**
     * 绑定虚拟号码的接口
     *
     * @param phoneA
     * @param phoneB
     * @return
     */
    @GetMapping("/bindNumber")
    public R<VirtualDto> bindNumber(@RequestParam String phoneA,
                                    @RequestParam String phoneB) {
        return R.ok(virtualNumberService.bindVirtualNumber(phoneA, phoneB));
    }

    /**
     * 绑定虚拟号码的接口
     *
     * @param subsId
     * @return
     */
    @GetMapping("/unbind")
    public R<Boolean> unbindNumber(@RequestParam String subsId) {
        return R.ok(virtualNumberService.unbindVirtualNumber(subsId));
    }
}
